home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000088_icon-group-sender _Fri May 14 11:12:38 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
2KB
Received: by cheltenham.cs.arizona.edu; Fri, 14 May 1993 12:27:10 MST
Via: uk.ac.manchester.computer-science; Fri, 14 May 1993 18:13:22 +0100
From: Steve Holden <steve@dtc.co.uk>
Date: Fri, 14 May 93 18:03:46 BST
Message-Id: <12646.9305141703@desktop.desktop.co.uk>
To: sboisen@bbn.com
Subject: Re: string stripping
Cc: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Sean:
The conventional way of stripping out unwanted characters woould, I
think, use string scanning. The basis is to use "upto()" to skip
any you don't want to avoid, and many() to skip the rest. The code
would look something like this:
procedure main()
full := "abc-def.ghi"
bare := ""
badchars := '-.'
full ? {
while bare ||:= tab(many(~badchars)) do
tab(many(badchars))
}
write(bare)
end
You may notice that despite my suggestion of using "upto()"
I actually used tab(many(~badchars)). This allows you to include
any trailing good characters as a part of the loop processing
rather than having to program in possible special cases.
This group being what it is you may well get several other good
(possibly even better :-) ideas on how to go about this.
regards
Steve
+---------------------------------+-------------------------------------+
| Steve Holden, Technical Director| Desktop Connection Limited |
| steve@desktop.co.uk | Manchester Science Park |
|---------------------------------+ Lloyd Street North |
| Publish and be damned. Publish | Manchester England M15 4EN |
| electronically and be heard. | Tel: +44 61 227 9055 Fax: 226 4922 |
+---------------------------------+-------------------------------------+